package cn.jbolt.ai.agent.controller;

import cn.jbolt.ai.app.service.AiAppConfigService;
import cn.jbolt.util.Pager;
import cn.jbolt.util.Result;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/agent")
@Tag(name = "标书智能体控制类")
public class AgentController {

    @Autowired
    private AiAppConfigService aiAppConfigService;


    @Operation(summary = "获取所有招标公告",
            description = "trainType训练类型" )
    @GetMapping("/noticeList")
    public Result listByPage(
            Integer page,
            Integer pageSize,
            @RequestParam(required = false) String keywords,
            @RequestParam(required = false) Long knowledgeBaseId,
            @RequestParam(required = false) String trainType,
            @RequestParam(required = false) Integer status) {
        List<Map<String, Object>> listMap = new ArrayList<>();
        Map<String,Object> map = new HashMap<>();
        map.put("noticetitle","绵阳市公安局经济技术开发区分局 街面巡防警务站设施设备采购竞争性磋商公告");
        map.put("noticetype","招标公告");
        map.put("province","四川");
        map.put("embedTime","2025-06-03");
        map.put("collectFlag",true);
        listMap.add(map);
        map = new HashMap<>();
        map.put("noticetitle","二综项目眼前节测量系统");
        map.put("noticetype","中标结果");
        map.put("province","重庆");
        map.put("embedTime","2025-06-03");
        map.put("collectFlag",false);
        listMap.add(map);
        map = new HashMap<>();
        map.put("noticetitle","珠海市金湾区红旗镇经济发展服务中心修缮工程定点议价采购公告");
        map.put("noticetype","招标公告");
        map.put("province","广东");
        map.put("embedTime","2025-06-03");
        map.put("collectFlag",true);
        listMap.add(map);
        map = new HashMap<>();
        map.put("noticetitle","新疆维吾尔自治区天山西部国有林管理局伊宁分局2025年6月至12月2025年第二批资金政府采购意向");
        map.put("noticetype","意向公开");
        map.put("province","新疆");
        map.put("embedTime","2025-06-03");
        map.put("collectFlag",false);
        listMap.add(map);


        List<List<Map<String, Object>>> resultList = new ArrayList<>();
        resultList.add(listMap);

        Page<Map<String,Object>> pager = new Page<Map<String, Object>>();
        pager.setRecords(listMap);

        return Result.success(Pager.from(pager));//fileService.listByPage(page, pageSize, keywords, knowledgeBaseId, trainType, status);
    }

    @Operation(summary = "获取所有招标公告",
            description = "trainType训练类型" )
    @GetMapping("/collectList")
    public Result collecListByPage(
            Integer page,
            Integer pageSize,
            @RequestParam(required = false) String keywords,
            @RequestParam(required = false) Long knowledgeBaseId,
            @RequestParam(required = false) String trainType,
            @RequestParam(required = false) Integer status) {
        List<Map<String, Object>> listMap = new ArrayList<>();
        Map<String,Object> map = new HashMap<>();
        map.put("noticetitle","绵阳市公安局经济技术开发区分局 街面巡防警务站设施设备采购竞争性磋商公告");
        map.put("noticetype","招标公告");
        map.put("province","四川");
        map.put("embedTime","2025-06-03");
        map.put("collectTime","2025-06-04");
        map.put("collectFlag",true);
        listMap.add(map);
        map = new HashMap<>();
        map.put("noticetitle","珠海市金湾区红旗镇经济发展服务中心修缮工程定点议价采购公告");
        map.put("noticetype","招标公告");
        map.put("province","广东");
        map.put("embedTime","2025-06-03");
        map.put("collectTime","2025-06-04");
        map.put("collectFlag",true);
        listMap.add(map);
        List<List<Map<String, Object>>> resultList = new ArrayList<>();
        resultList.add(listMap);

        Page<Map<String,Object>> pager = new Page<Map<String, Object>>();
        pager.setRecords(listMap);

        return Result.success(Pager.from(pager));//fileService.listByPage(page, pageSize, keywords, knowledgeBaseId, trainType, status);
    }


    @Operation(summary = "获取所有订阅列表",
            description = "trainType训练类型" )
    @GetMapping("/subsList")
    public Result subsListByPage(
            Integer page,
            Integer pageSize,
            @RequestParam(required = false) String keywords,
            @RequestParam(required = false) Long knowledgeBaseId,
            @RequestParam(required = false) String trainType,
            @RequestParam(required = false) Integer status) {
        List<Map<String, Object>> listMap = new ArrayList<>();
        Map<String,Object> map = new HashMap<>();
        map.put("subsName","测试");
        map.put("subsKeys","经济适用房,别墅,土方,土建,工程服务");
        map.put("subsArea","四川");
        map.put("noticeType","工程建筑");
        listMap.add(map);
        map = new HashMap<>();
        map.put("subsName","测试2");
        map.put("subsKeys","经济适用房,别墅,土方,土建,工程服务");
        map.put("subsArea","上海");
        map.put("noticeType","工程建筑");
        listMap.add(map);
        List<List<Map<String, Object>>> resultList = new ArrayList<>();
        resultList.add(listMap);

        Page<Map<String,Object>> pager = new Page<Map<String, Object>>();
        pager.setRecords(listMap);

        return Result.success(Pager.from(pager));//fileService.listByPage(page, pageSize, keywords, knowledgeBaseId, trainType, status);
    }

    @Operation(summary = "获取所有标讯推荐",
            description = "trainType训练类型" )
    @GetMapping("/commandList")
    public Result commandListByPage(
            Integer page,
            Integer pageSize,
            @RequestParam(required = false) String keywords,
            @RequestParam(required = false) Long knowledgeBaseId,
            @RequestParam(required = false) String trainType,
            @RequestParam(required = false) Integer status) {
        List<Map<String, Object>> listMap = new ArrayList<>();
        Map<String,Object> map = new HashMap<>();
        map.put("noticeType","绵阳市公安局经济技术开发区分局 街面巡防警务站设施设备采购竞争性磋商公告");
        map.put("noticeTitle","招标公告");
        map.put("buyType","公开招标");
        map.put("province","四川");
        map.put("ysAmt","18530000元");
        map.put("embedTime","2024-12-06");
        listMap.add(map);
        map = new HashMap<>();
        map.put("noticeType","县城中小学幼儿园专职保安服务项目的采购公告");
        map.put("noticeTitle","招标公告");
        map.put("buyType","公开招标");
        map.put("province","重庆");
        map.put("ysAmt","1101168");
        map.put("embedTime","2025-06-04");
        listMap.add(map);
        List<List<Map<String, Object>>> resultList = new ArrayList<>();
        resultList.add(listMap);

        Page<Map<String,Object>> pager = new Page<Map<String, Object>>();
        pager.setRecords(listMap);

        return Result.success(Pager.from(pager));//fileService.listByPage(page, pageSize, keywords, knowledgeBaseId, trainType, status);
    }
}
